package day15;

import java.util.*;

public class Shop {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        Map<String,Integer> map=new HashMap<>();
        while (true){
            System.out.print("请输入商品名称：");
            String s= sc.next();
            if ("end".equals(s)){
                break;
            }
            if (map.containsKey(s)){
                map.put(s,map.get(s)+1);
            }else {
                map.put(s,1);
            }
        }
        for (Map.Entry<String,Integer> o:map.entrySet()){
            String k=o.getKey();
            Integer v=o.getValue();
            System.out.println(k+" "+v);
        }
    }
}


